

<template>
    <view style="margin-top: 500rpx">
        <image
            @tap="previewImage"
            id="preview1"
            ref="imgPos"
            style="width: 200rpx; height: 200rpx"
            src="/static/img/1.jpg"
        ></image>
    </view>

    <imagePreview ref="preview"></imagePreview>
</template>

<script setup lang="ts">
import { ref, reactive } from "vue";
import { onReady, onShow, onLoad, onUnload } from "@dcloudio/uni-app";
// import { userData as userDataStore } from "@/store/userData";
// import { systemInfo as systemInfoStore } from "@/store/systemInfo";
// import { getGroupMember } from "@/api/api";
// import { updateGroupProfile } from "@/hooks/imHooks";
// import { config as configStore } from "@/store/config";
import cacheimg from "@/components/cacheimg.vue";
import testc from "@/components/testc.vue";
import imagePreview from "@/components/imagePreview.vue";

const preview = ref(null);

const imgPos = ref(null);

const previewImage = async () => {
    /* #ifndef APP-NVUE */
    uni.createSelectorQuery()
        .select(`#preview1`)
        .boundingClientRect((data) => {
            console.log("ddddddd");
            console.log("ddddddd");
            console.log("ddddddd");

            console.log(data);
            let param = {
                data: data, //图片的初始大小与位置
                url: "/static/img/1.jpg", //当前图片地址
                urls: [
                    "/static/img/1.jpg",
                    "/static/img/2.jpg",
                    "/static/img/3.jpg",
                ], //预览集合图片地址
            };
            preview.value.open(param);
        })
        .exec();
    /*#endif*/

    /*#ifdef APP-NVUE*/
    await new Promise((callback) => {
        const dom = weex.requireModule("dom");
        dom.getComponentRect(imgPos.value, (e) => {
            console.log("eeeeeeeeeee");
            console.log("eeeeeeeeeee");
            console.log("eeeeeeeeeee");
            console.log(e);
            let param = {
                data: e.size, //图片的初始大小与位置
                url: "/static/img/1.jpg", //当前图片地址
                urls: [
                    "/static/img/1.jpg",
                    "/static/img/2.jpg",
                    "/static/img/3.jpg",
                ], //预览集合图片地址
            };
            preview.value.open(param);
        });
    });
    /*#endif*/
};

//import FOODS from '@/const/food_all'

const flag = ref(true);
const input_ref = ref(null);

const foods = ref([]);

const close = (e: any) => {
    console.log("cccccccccccccc");
    console.log("cccccccccccccc");
    console.log("cccccccccccccc");
    console.log("cccccccccccccc");
    e.stopPropagation();
    e.preventDefault();
    // flag.value = false;
    // setTimeout(()=>{
    //     input_ref.value.focus();
    // },100)
};

const goBack = () => {
    uni.navigateBack();
};

const touchstart = (e: any) => {
    e.stopPropagation();
    e.preventDefault();
};

const hide = (e: any) => {
    e.stopPropagation();
    e.preventDefault();
    uni.hideKeyboard();
};

const longpress = (e: any) => {
    e.stopPropagation();
    e.preventDefault();
    console.log("longpress");
    console.log("longpress");
    console.log("longpress");
    console.log("longpress");
};

const aaa = (e: any) => {
    e.stopPropagation();
    e.preventDefault();
};

const inputText = ref("");

onReady(() => {});

onLoad((option: any) => {
    console.log("foods");
    console.log("foods");
    console.log("foods");
    console.log(foods);
});

onUnload(() => {});

onShow(() => {});
</script>

<style lang="scss" scoped>
.picker-view {
    width: 750rpx;
    height: 600rpx;
    margin-top: 20rpx;
}
.item {
    line-height: 100rpx;
    text-align: center;
}

.row {
    width: 750rpx;
    height: 100rpx;
}
.yy {
    position: absolute;
    width: 750rpx;
    height: 100rpx;
    top: 600rpx;
    background: yellow;
    // &.active{
    //     height:0;
    // }
}

.bbb {
    width: 750rpx;
    height: 500rpx;
    background: blue;
}
</style>
